-- CALC_CHRISTMAS_TREE_BONUS

-- 计算圣诞树奖励
return function(user, bonusArg)
    local ret = {};
    local layer = DungeonM.currentLayer();

    local bonus1 = { ["bonus"] = { 1, 1513, 6 }, ["ratio"] = 20 }; -- 圣诞五角星×6
    if DungeonServiceM.isStatItemLimit(1513) or layer <= 5 then
        bonus1["ratio"] = 0;
    elseif layer >= 14 then
        return { { 1, 1513, 6 } };
    end

    local bonus2 = { ["bonus"] = { 1, 8266, 1 }, ["ratio"] = 10 }; -- 圣诞帽子×1
    if DungeonServiceM.isStatItemLimit(8266) then
        bonus2["ratio"] = 0;
    end

    local bonus3 = { ["bonus"] = { 1, 7593, 1 }, ["ratio"] = 5 };  -- 永恒冰晶×1
    if BuildingBonusM.getFieldStat("eternal_ice") >= 3 or
        DungeonServiceM.isStatItemLimit(7593) then
        bonus3["ratio"] = 0;
    end

    local bonus4 = { ["bonus"] = { 1, 8267, 1 }, ["ratio"] = 15 }; -- 驯鹿角×1
    if DungeonServiceM.isStatItemLimit(8267) then
        bonus4["ratio"] = 0;
    end

    local bonus5 = { ["bonus"] = { 1, 7595, 1 }, ["ratio"] = 12 }; -- 圣诞饼干×1
    local bonus6 = { ["bonus"] = { 1, 7594, 1 }, ["ratio"] = 12 }; -- 拐杖糖×1
    local bonus7 = { ["bonus"] = { 1, 7592, 1 }, ["ratio"] = 20 }; -- 圣诞铃铛×1
    local bonus8 = { ["bonus"] = { 1, 7592, 3 }, ["ratio"] = 5 };  -- 圣诞铃铛×3

    local arr = { bonus1, bonus2, bonus3, bonus4, bonus5, bonus6, bonus7, bonus8, };
    local seed = DungeonM.getRandSeed("CALC_CHRISTMAS_TREE_BONUS");
    table.insert(ret, fetchElemBySeed(arr, seed)["bonus"]);

    return ret;
end